home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 October: Mac OS SDK / Dev.CD Oct 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / CIncludes / Controls.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-12  |  24.2 KB  |  753 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Controls.h
  3.  
  4.      Contains:    Control Manager interfaces
  5.  
  6.      Version:    Technology:    MacOS 7.x
  7.                  Release:    Universal Interfaces 3.0.1
  8.  
  9.      Copyright:    © 1985-1997 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __CONTROLS__
  19. #define __CONTROLS__
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. #ifndef __QUICKDRAW__
  25. #include <Quickdraw.h>
  26. #endif
  27. #ifndef __MENUS__
  28. #include <Menus.h>
  29. #endif
  30.  
  31.  
  32.  
  33. #if PRAGMA_ONCE
  34. #pragma once
  35. #endif
  36.  
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40.  
  41. #if PRAGMA_IMPORT
  42. #pragma import on
  43. #endif
  44.  
  45. #if PRAGMA_STRUCT_ALIGN
  46.     #pragma options align=mac68k
  47. #elif PRAGMA_STRUCT_PACKPUSH
  48.     #pragma pack(push, 2)
  49. #elif PRAGMA_STRUCT_PACK
  50.     #pragma pack(2)
  51. #endif
  52.  
  53. /*
  54.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  55.       • Resource types
  56.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  57. */
  58.  
  59. enum {
  60.     kControlDefProcType            = FOUR_CHAR_CODE('CDEF'),
  61.     kControlTemplateResourceType = FOUR_CHAR_CODE('CNTL'),
  62.     kControlColorTableResourceType = FOUR_CHAR_CODE('cctb'),
  63.     kControlDefProcResourceType    = FOUR_CHAR_CODE('CDEF')
  64. };
  65.  
  66. /*
  67.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  68.       • Format of a 'CNTL' resource
  69.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  70. */
  71.  
  72. struct ControlTemplate {
  73.     Rect                             controlRect;
  74.     SInt16                             controlValue;
  75.     Boolean                         controlVisible;
  76.     UInt8                             fill;
  77.     SInt16                             controlMaximum;
  78.     SInt16                             controlMinimum;
  79.     SInt16                             controlDefProcID;
  80.     SInt32                             controlReference;
  81.     Str255                             controlTitle;
  82. };
  83. typedef struct ControlTemplate ControlTemplate;
  84.  
  85. typedef ControlTemplate *                ControlTemplatePtr;
  86. typedef ControlTemplatePtr *            ControlTemplateHandle;
  87. /*
  88.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  89.    • CONTROL DEFINITION ID'S
  90.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  91. */
  92.  
  93. /* Standard System 7 procID's*/
  94.  
  95.  
  96. enum {
  97.     pushButProc                    = 0,
  98.     checkBoxProc                = 1,
  99.     radioButProc                = 2,
  100.     scrollBarProc                = 16,
  101.     popupMenuProc                = 1008
  102. };
  103.  
  104. /*
  105.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  106.    • VARIANT CODES
  107.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  108. */
  109. typedef SInt16                             ControlVariant;
  110.  
  111. enum {
  112.     kControlNoVariant            = 0,                            /* No variant*/
  113.     kControlUsesOwningWindowsFontVariant = 1 << 3                /* Control uses owning windows font to display text*/
  114. };
  115.  
  116. /*
  117.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  118.    • CONTROL PART CODES
  119.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  120. */
  121. typedef SInt16                             ControlPartCode;
  122.  
  123. enum {
  124.     kControlNoPart                = 0,
  125.     kControlLabelPart            = 1,
  126.     kControlMenuPart            = 2,
  127.     kControlTrianglePart        = 4,
  128.     kControlButtonPart            = 10,
  129.     kControlCheckBoxPart        = 11,
  130.     kControlRadioButtonPart        = 11,
  131.     kControlUpButtonPart        = 20,
  132.     kControlDownButtonPart        = 21,
  133.     kControlPageUpPart            = 22,
  134.     kControlPageDownPart        = 23,
  135.     kControlIndicatorPart        = 129,
  136.     kControlDisabledPart        = 254,
  137.     kControlInactivePart        = 255
  138. };
  139.  
  140. /*
  141.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  142.    • CHECK BOX VALUES
  143.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  144. */
  145.  
  146.  
  147. enum {
  148.     kControlCheckBoxUncheckedValue = 0,
  149.     kControlCheckBoxCheckedValue = 1,
  150.     kControlCheckBoxMixedValue    = 2
  151. };
  152.  
  153. /*
  154.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  155.    • RADIO BUTTON VALUES
  156.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  157. */
  158.  
  159.  
  160. enum {
  161.     kControlRadioButtonUncheckedValue = 0,
  162.     kControlRadioButtonCheckedValue = 1,
  163.     kControlRadioButtonMixedValue = 2
  164. };
  165.  
  166. /*
  167.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  168.    
  169.    • CONTROL POP-UP MENU CONSTANTS
  170.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  171. */
  172.  
  173. /* Variant codes for the System 7 pop-up menu*/
  174.  
  175. enum {
  176.     popupFixedWidth                = 1 << 0,
  177.     popupVariableWidth            = 1 << 1,
  178.     popupUseAddResMenu            = 1 << 2,
  179.     popupUseWFont                = 1 << 3
  180. };
  181.  
  182. /* Menu label styles for the System 7 pop-up menu */
  183.  
  184. enum {
  185.     popupTitleBold                = 1 << 8,
  186.     popupTitleItalic            = 1 << 9,
  187.     popupTitleUnderline            = 1 << 10,
  188.     popupTitleOutline            = 1 << 11,
  189.     popupTitleShadow            = 1 << 12,
  190.     popupTitleCondense            = 1 << 13,
  191.     popupTitleExtend            = 1 << 14,
  192.     popupTitleNoStyle            = 1 << 15
  193. };
  194.  
  195. /* Menu label justifications for the System 7 pop-up menu*/
  196.  
  197. enum {
  198.     popupTitleLeftJust            = 0x00000000,
  199.     popupTitleCenterJust        = 0x00000001,
  200.     popupTitleRightJust            = 0x000000FF
  201. };
  202.  
  203. /*
  204.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  205.    • CONTROL DRAGGRAYRGN CONSTANTS
  206.      For DragGrayRgnUPP used in TrackControl() 
  207.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  208. */
  209.  
  210.  
  211. enum {
  212.     noConstraint                = kNoConstraint,
  213.     hAxisOnly                    = 1,
  214.     vAxisOnly                    = 2
  215. };
  216.  
  217. /*
  218.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  219.    • CONTROL COLOR TABLE PART CODES
  220.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  221. */
  222.  
  223.  
  224. enum {
  225.     cFrameColor                    = 0,
  226.     cBodyColor                    = 1,
  227.     cTextColor                    = 2,
  228.     cThumbColor                    = 3,
  229.     kNumberCtlCTabEntries        = 4
  230. };
  231.  
  232. /*
  233.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  234.    • CONTROLHANDLE
  235.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  236. */
  237.  
  238. typedef struct ControlRecord             ControlRecord;
  239. typedef ControlRecord *                    ControlPtr;
  240. typedef ControlPtr *                    ControlHandle;
  241. /* ControlRef is obsolete. Use ControlHandle. */
  242. typedef ControlHandle                     ControlRef;
  243. /*
  244.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  245.    • CONTROL ACTIONPROC POINTER
  246.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  247. */
  248. typedef CALLBACK_API( void , ControlActionProcPtr )(ControlHandle theControl, ControlPartCode partCode);
  249. typedef STACK_UPP_TYPE(ControlActionProcPtr)                     ControlActionUPP;
  250. /*
  251.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  252.    • CONTROL COLOR TABLE
  253.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  254. */
  255. struct CtlCTab {
  256.     SInt32                             ccSeed;
  257.     SInt16                             ccRider;
  258.     SInt16                             ctSize;
  259.     ColorSpec                         ctTable[4];
  260. };
  261. typedef struct CtlCTab CtlCTab;
  262.  
  263. typedef CtlCTab *                        CCTabPtr;
  264. typedef CCTabPtr *                        CCTabHandle;
  265. /*
  266.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  267.    • CONTROL RECORD
  268.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  269. */
  270. struct ControlRecord {
  271.     ControlHandle                     nextControl;
  272.     WindowPtr                         contrlOwner;
  273.     Rect                             contrlRect;
  274.     UInt8                             contrlVis;
  275.     UInt8                             contrlHilite;
  276.     SInt16                             contrlValue;
  277.     SInt16                             contrlMin;
  278.     SInt16                             contrlMax;
  279.     Handle                             contrlDefProc;
  280.     Handle                             contrlData;
  281.     ControlActionUPP                 contrlAction;
  282.     SInt32                             contrlRfCon;
  283.     Str255                             contrlTitle;
  284. };
  285.  
  286. /*
  287.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  288.    • AUXILLARY CONTROL RECORD STRUCTURE
  289.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  290. */
  291. struct AuxCtlRec {
  292.     Handle                             acNext;
  293.     ControlHandle                     acOwner;
  294.     CCTabHandle                     acCTable;
  295.     SInt16                             acFlags;
  296.     SInt32                             acReserved;
  297.     SInt32                             acRefCon;
  298. };
  299. typedef struct AuxCtlRec AuxCtlRec;
  300.  
  301. typedef AuxCtlRec *                        AuxCtlPtr;
  302. typedef AuxCtlPtr *                        AuxCtlHandle;
  303. /*
  304.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  305.    • POP-UP MENU PRIVATE DATA STRUCTURE
  306.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  307. */
  308. struct PopupPrivateData {
  309.     MenuHandle                         mHandle;
  310.     SInt16                             mID;
  311. };
  312. typedef struct PopupPrivateData PopupPrivateData;
  313.  
  314. typedef PopupPrivateData *                PopupPrivateDataPtr;
  315. typedef PopupPrivateDataPtr *            PopupPrivateDataHandle;
  316. /*
  317.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  318.    • CONTROL ACTION PROC UPP'S
  319.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  320. */
  321.  
  322.  
  323. enum { uppControlActionProcInfo = 0x000002C0 };                 /* pascal no_return_value Func(4_bytes, 2_bytes) */
  324. #define NewControlActionProc(userRoutine)                         (ControlActionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlActionProcInfo, GetCurrentArchitecture())
  325. #define CallControlActionProc(userRoutine, theControl, partCode)  CALL_TWO_PARAMETER_UPP((userRoutine), uppControlActionProcInfo, (theControl), (partCode))
  326. /*
  327.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  328.       
  329.    • CONTROL CREATION / DELETION API'S
  330.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  331. */
  332. EXTERN_API( ControlHandle )
  333. NewControl                        (WindowPtr                 owningWindow,
  334.                                  const Rect *            boundsRect,
  335.                                  ConstStr255Param         controlTitle,
  336.                                  Boolean                 initiallyVisible,
  337.                                  SInt16                 initialValue,
  338.                                  SInt16                 minimumValue,
  339.                                  SInt16                 maximumValue,
  340.                                  SInt16                 procID,
  341.                                  SInt32                 controlReference)                    ONEWORDINLINE(0xA954);
  342.  
  343. EXTERN_API( ControlHandle )
  344. GetNewControl                    (SInt16                 resourceID,
  345.                                  WindowPtr                 owningWindow)                        ONEWORDINLINE(0xA9BE);
  346.  
  347. EXTERN_API( void )
  348. DisposeControl                    (ControlHandle             theControl)                            ONEWORDINLINE(0xA955);
  349.  
  350. EXTERN_API( void )
  351. KillControls                    (WindowPtr                 theWindow)                            ONEWORDINLINE(0xA956);
  352.  
  353. /*
  354.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  355.       
  356.    • CONTROL SHOWING/HIDING API'S
  357.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  358. */
  359.  
  360. EXTERN_API( void )
  361. ShowControl                        (ControlHandle             theControl)                            ONEWORDINLINE(0xA957);
  362.  
  363. EXTERN_API( void )
  364. HideControl                        (ControlHandle             theControl)                            ONEWORDINLINE(0xA958);
  365.  
  366. /*
  367.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  368.       
  369.    • CONTROL DRAWING API'S
  370.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  371. */
  372.  
  373. EXTERN_API( void )
  374. DrawControls                    (WindowPtr                 theWindow)                            ONEWORDINLINE(0xA969);
  375.  
  376. EXTERN_API( void )
  377. Draw1Control                    (ControlHandle             theControl)                            ONEWORDINLINE(0xA96D);
  378.  
  379. #define DrawOneControl(theControl) Draw1Control(theControl)
  380.  
  381. EXTERN_API( void )
  382. UpdateControls                    (WindowPtr                 theWindow,
  383.                                  RgnHandle                 updateRegion)                        ONEWORDINLINE(0xA953);
  384.  
  385. /*
  386.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  387.       
  388.    • CONTROL HIGHLIGHT API'S
  389.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  390. */
  391.  
  392. EXTERN_API( void )
  393. HiliteControl                    (ControlHandle             theControl,
  394.                                  ControlPartCode         hiliteState)                        ONEWORDINLINE(0xA95D);
  395.  
  396. /*
  397.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  398.       
  399.    • CONTROL TRACKING/DRAGGING API'S
  400.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  401. */
  402.  
  403. /*
  404.       When using the TrackControl() call when tracking an indicator, the actionProc parameter (type ControlActionUPP) 
  405.     should be replaced by a parameter of type DragGrayRgnUPP (see Quickdraw.h).
  406. */
  407. EXTERN_API( ControlPartCode )
  408. TrackControl                    (ControlHandle             theControl,
  409.                                  Point                     startPoint,
  410.                                  ControlActionUPP         actionProc)                            ONEWORDINLINE(0xA968);
  411.  
  412. EXTERN_API( void )
  413. DragControl                        (ControlHandle             theControl,
  414.                                  Point                     startPoint,
  415.                                  const Rect *            limitRect,
  416.                                  const Rect *            slopRect,
  417.                                  DragConstraint         axis)                                ONEWORDINLINE(0xA967);
  418.  
  419. EXTERN_API( ControlPartCode )
  420. TestControl                        (ControlHandle             theControl,
  421.                                  Point                     testPoint)                            ONEWORDINLINE(0xA966);
  422.  
  423. EXTERN_API( ControlPartCode )
  424. FindControl                        (Point                     testPoint,
  425.                                  WindowPtr                 theWindow,
  426.                                  ControlHandle *        theControl)                            ONEWORDINLINE(0xA96C);
  427.  
  428. /*
  429.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  430.       
  431.    • CONTROL MOVING/SIZING API'S
  432.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  433. */
  434.  
  435. EXTERN_API( void )
  436. MoveControl                        (ControlHandle             theControl,
  437.                                  SInt16                 h,
  438.                                  SInt16                 v)                                    ONEWORDINLINE(0xA959);
  439.  
  440. EXTERN_API( void )
  441. SizeControl                        (ControlHandle             theControl,
  442.                                  SInt16                 w,
  443.                                  SInt16                 h)                                    ONEWORDINLINE(0xA95C);
  444.  
  445. /*
  446.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  447.       
  448.    • CONTROL TITLE API'S
  449.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  450. */
  451.  
  452. EXTERN_API( void )
  453. SetControlTitle                    (ControlHandle             theControl,
  454.                                  ConstStr255Param         title)                                ONEWORDINLINE(0xA95F);
  455.  
  456. EXTERN_API( void )
  457. GetControlTitle                    (ControlHandle             theControl,
  458.                                  Str255                 title)                                ONEWORDINLINE(0xA95E);
  459.  
  460. /*
  461.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  462.       
  463.    • CONTROL VALUE, MIMIMUM, AND MAXIMUM API'S
  464.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  465. */
  466.  
  467. EXTERN_API( SInt16 )
  468. GetControlValue                    (ControlHandle             theControl)                            ONEWORDINLINE(0xA960);
  469.  
  470. EXTERN_API( void )
  471. SetControlValue                    (ControlHandle             theControl,
  472.                                  SInt16                 newValue)                            ONEWORDINLINE(0xA963);
  473.  
  474. EXTERN_API( SInt16 )
  475. GetControlMinimum                (ControlHandle             theControl)                            ONEWORDINLINE(0xA961);
  476.  
  477. EXTERN_API( void )
  478. SetControlMinimum                (ControlHandle             theControl,
  479.                                  SInt16                 newMinimum)                            ONEWORDINLINE(0xA964);
  480.  
  481. EXTERN_API( SInt16 )
  482. GetControlMaximum                (ControlHandle             theControl)                            ONEWORDINLINE(0xA962);
  483.  
  484. EXTERN_API( void )
  485. SetControlMaximum                (ControlHandle             theControl,
  486.                                  SInt16                 newMaximum)                            ONEWORDINLINE(0xA965);
  487.  
  488. /*
  489.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  490.       
  491.    • CONTROL VARIANT AND WINDOW INFORMATION API'S
  492.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  493. */
  494.  
  495. EXTERN_API( ControlVariant )
  496. GetControlVariant                (ControlHandle             theControl)                            ONEWORDINLINE(0xA809);
  497.  
  498. /*
  499.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  500.       
  501.    • CONTROL ACTION PROC API'S
  502.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  503. */
  504.  
  505. EXTERN_API( void )
  506. SetControlAction                (ControlHandle             theControl,
  507.                                  ControlActionUPP         actionProc)                            ONEWORDINLINE(0xA96B);
  508.  
  509. EXTERN_API( ControlActionUPP )
  510. GetControlAction                (ControlHandle             theControl)                            ONEWORDINLINE(0xA96A);
  511.  
  512. /*
  513.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  514.       
  515.    • CONTROL ACCESSOR API'S
  516.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  517. */
  518.  
  519. EXTERN_API( void )
  520. SetControlReference                (ControlHandle             theControl,
  521.                                  SInt32                 data)                                ONEWORDINLINE(0xA95B);
  522.  
  523. EXTERN_API( SInt32 )
  524. GetControlReference                (ControlHandle             theControl)                            ONEWORDINLINE(0xA95A);
  525.  
  526. EXTERN_API( Boolean )
  527. GetAuxiliaryControlRecord        (ControlHandle             theControl,
  528.                                  AuxCtlHandle *            acHndl)                                ONEWORDINLINE(0xAA44);
  529.  
  530. EXTERN_API( void )
  531. SetControlColor                    (ControlHandle             theControl,
  532.                                  CCTabHandle             newColorTable)                        ONEWORDINLINE(0xAA43);
  533.  
  534. #define GetControlListFromWindow(theWindow)        ( *(ControlHandle *) (((UInt8 *) theWindow) + sizeof(GrafPort) + 0x20))
  535. #define GetControlOwningWindowControlList(theWindow)        ( *(ControlHandle *) (((UInt8 *) theWindow) + sizeof(GrafPort) + 0x20))
  536. /*
  537.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  538.       
  539.    • VALID 'CDEF' MESSAGES
  540.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  541. */
  542.  
  543. typedef SInt16                             ControlDefProcMessage;
  544.  
  545. enum {
  546.     drawCntl                    = 0,
  547.     testCntl                    = 1,
  548.     calcCRgns                    = 2,
  549.     initCntl                    = 3,
  550.     dispCntl                    = 4,
  551.     posCntl                        = 5,
  552.     thumbCntl                    = 6,
  553.     dragCntl                    = 7,
  554.     autoTrack                    = 8,
  555.     calcCntlRgn                    = 10,
  556.     calcThumbRgn                = 11,
  557.     drawThumbOutline            = 12
  558. };
  559.  
  560. /*
  561.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  562.       
  563.    • MAIN ENTRY POINT FOR 'CDEF'
  564.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  565. */
  566.  
  567. typedef CALLBACK_API( SInt32 , ControlDefProcPtr )(SInt16 varCode, ControlHandle theControl, ControlDefProcMessage message, SInt32 param);
  568. typedef STACK_UPP_TYPE(ControlDefProcPtr)                         ControlDefUPP;
  569. enum { uppControlDefProcInfo = 0x00003BB0 };                     /* pascal 4_bytes Func(2_bytes, 4_bytes, 2_bytes, 4_bytes) */
  570. #define NewControlDefProc(userRoutine)                             (ControlDefUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlDefProcInfo, GetCurrentArchitecture())
  571. #define CallControlDefProc(userRoutine, varCode, theControl, message, param)  CALL_FOUR_PARAMETER_UPP((userRoutine), uppControlDefProcInfo, (varCode), (theControl), (message), (param))
  572. /*
  573.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  574.       
  575.    • CONSTANTS FOR DRAWCNTL MESSAGE PASSED IN PARAM
  576.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  577. */
  578.  
  579. enum {
  580.     kDrawControlEntireControl    = 0,
  581.     kDrawControlIndicatorOnly    = 129
  582. };
  583.  
  584. /*
  585.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  586.       
  587.    • CONSTANTS FOR DRAGCNTL MESSAGE PASSED IN PARAM
  588.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  589. */
  590.  
  591.  
  592. enum {
  593.     kDragControlEntireControl    = 0,
  594.     kDragControlIndicator        = 1
  595. };
  596.  
  597. /*
  598.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  599.       
  600.    • DRAG CONSTRAINT STRUCTURE PASSED IN PARAM FOR THUMBCNTL MESSAGE (IM I-332)
  601.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  602. */
  603.  
  604. struct IndicatorDragConstraint {
  605.     Rect                             limitRect;
  606.     Rect                             slopRect;
  607.     DragConstraint                     axis;
  608. };
  609. typedef struct IndicatorDragConstraint IndicatorDragConstraint;
  610.  
  611. typedef IndicatorDragConstraint *        IndicatorDragConstraintPtr;
  612. typedef IndicatorDragConstraintPtr *    IndicatorDragConstraintHandle;
  613. #if CGLUESUPPORTED
  614. /*
  615.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  616.    • C GLUE
  617.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  618. */
  619. EXTERN_API_C( void )
  620. dragcontrol                        (ControlHandle             theControl,
  621.                                  Point *                startPt,
  622.                                  const Rect *            limitRect,
  623.                                  const Rect *            slopRect,
  624.                                  short                     axis);
  625.  
  626. EXTERN_API_C( ControlHandle )
  627. newcontrol                        (WindowPtr                 theWindow,
  628.                                  const Rect *            boundsRect,
  629.                                  const char *            title,
  630.                                  Boolean                 visible,
  631.                                  short                     value,
  632.                                  short                     min,
  633.                                  short                     max,
  634.                                  short                     procID,
  635.                                  long                     refCon);
  636.  
  637. EXTERN_API_C( short )
  638. findcontrol                        (Point *                thePoint,
  639.                                  WindowPtr                 theWindow,
  640.                                  ControlHandle *        theControl);
  641.  
  642. EXTERN_API_C( void )
  643. getcontroltitle                    (ControlHandle             theControl,
  644.                                  char *                    title);
  645.  
  646. EXTERN_API_C( void )
  647. setcontroltitle                    (ControlHandle             theControl,
  648.                                  const char *            title);
  649.  
  650. EXTERN_API_C( short )
  651. trackcontrol                    (ControlHandle             theControl,
  652.                                  Point *                thePoint,
  653.                                  ControlActionUPP         actionProc);
  654.  
  655. EXTERN_API_C( short )
  656. testcontrol                        (ControlHandle             theControl,
  657.                                  Point *                thePt);
  658.  
  659. #endif  /* CGLUESUPPORTED */
  660.  
  661. #if OLDROUTINENAMES
  662. /*
  663.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  664.    • OLDROUTINENAMES
  665.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  666. */
  667. /* Variants applicable to all controls (at least ones with text)*/
  668.  
  669. enum {
  670.     useWFont                    = popupUseWFont
  671. };
  672.  
  673.  
  674. enum {
  675.     kControlCheckboxUncheckedValue = kControlCheckBoxUncheckedValue,
  676.     kControlCheckboxCheckedValue = kControlCheckBoxCheckedValue,
  677.     kControlCheckboxMixedValue    = kControlCheckBoxMixedValue
  678. };
  679.  
  680.  
  681. enum {
  682.     inLabel                        = kControlLabelPart,
  683.     inMenu                        = kControlMenuPart,
  684.     inTriangle                    = kControlTrianglePart,
  685.     inButton                    = kControlButtonPart,
  686.     inCheckBox                    = kControlCheckBoxPart,
  687.     inUpButton                    = kControlUpButtonPart,
  688.     inDownButton                = kControlDownButtonPart,
  689.     inPageUp                    = kControlPageUpPart,
  690.     inPageDown                    = kControlPageDownPart,
  691.     inThumb                        = kControlIndicatorPart
  692. };
  693.  
  694.  
  695. enum {
  696.     kNoHiliteControlPart        = kControlNoPart,
  697.     kInLabelControlPart            = kControlLabelPart,
  698.     kInMenuControlPart            = kControlMenuPart,
  699.     kInTriangleControlPart        = kControlTrianglePart,
  700.     kInButtonControlPart        = kControlButtonPart,
  701.     kInCheckBoxControlPart        = kControlCheckBoxPart,
  702.     kInUpButtonControlPart        = kControlUpButtonPart,
  703.     kInDownButtonControlPart    = kControlDownButtonPart,
  704.     kInPageUpControlPart        = kControlPageUpPart,
  705.     kInPageDownControlPart        = kControlPageDownPart,
  706.     kInIndicatorControlPart        = kControlIndicatorPart,
  707.     kReservedControlPart        = kControlDisabledPart,
  708.     kControlInactiveControlPart    = kControlInactivePart
  709. };
  710.  
  711. #define SetCTitle(theControl, title) SetControlTitle(theControl, title)
  712. #define GetCTitle(theControl, title) GetControlTitle(theControl, title)
  713. #define UpdtControl(theWindow, updateRgn) UpdateControls(theWindow, updateRgn)
  714. #define SetCtlValue(theControl, theValue) SetControlValue(theControl, theValue)
  715. #define GetCtlValue(theControl) GetControlValue(theControl)
  716. #define SetCtlMin(theControl, minValue) SetControlMinimum(theControl, minValue)
  717. #define GetCtlMin(theControl) GetControlMinimum(theControl)
  718. #define SetCtlMax(theControl, maxValue) SetControlMaximum(theControl, maxValue)
  719. #define GetCtlMax(theControl) GetControlMaximum(theControl)
  720. #define GetAuxCtl(theControl, acHndl) GetAuxiliaryControlRecord(theControl, acHndl)
  721. #define SetCRefCon(theControl, data) SetControlReference(theControl, data)
  722. #define GetCRefCon(theControl) GetControlReference(theControl)
  723. #define SetCtlAction(theControl, actionProc) SetControlAction(theControl, actionProc)
  724. #define GetCtlAction(theControl) GetControlAction(theControl)
  725. #define SetCtlColor(theControl, newColorTable) SetControlColor(theControl, newColorTable)
  726. #define GetCVariant(theControl) GetControlVariant(theControl)
  727. #define getctitle(theControl, title) getcontroltitle(theControl, title)
  728. #define setctitle(theControl, title) setcontroltitle(theControl, title)
  729. #endif  /* OLDROUTINENAMES */
  730.  
  731.  
  732.  
  733. #if PRAGMA_STRUCT_ALIGN
  734.     #pragma options align=reset
  735. #elif PRAGMA_STRUCT_PACKPUSH
  736.     #pragma pack(pop)
  737. #elif PRAGMA_STRUCT_PACK
  738.     #pragma pack()
  739. #endif
  740.  
  741. #ifdef PRAGMA_IMPORT_OFF
  742. #pragma import off
  743. #elif PRAGMA_IMPORT
  744. #pragma import reset
  745. #endif
  746.  
  747. #ifdef __cplusplus
  748. }
  749. #endif
  750.  
  751. #endif /* __CONTROLS__ */
  752.  
  753.